package com.example.Annocation.value.Values;

import com.example.Annocation.value.commons.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 * @Description TODO
 * @Date 2024/5/15 13:51
 * @Created by houjunfeng
 */
@Configuration
//这个value可以是数组
@PropertySource(value = "classpath:/spring.properties")
public class ValueConfigeration {
    @Bean(name="Person")
    public Person getPerson(){
        return new Person();
    }
    //这个bean可以以下防止打印Person(name=${person.name}, age=20, score=22)
    // @Value("${person.name}")
    // public String name;
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}
